﻿using System;

namespace ReferenceSwap
{
    /// <summary>
    /// Base Visual Studio Reference 
    /// </summary>
    public abstract class Reference : IEquatable<Reference>
    {
        /// <summary>
        /// Gets or Sets the Path to the Reference
        /// </summary>
        public virtual string Path { get; set; }
        /// <summary>
        /// Gets or Sets the Name of the Reference
        /// </summary>
        public virtual string Name { get; set; }

        /// <summary>
        /// Create a Visual studio project xml representation of the reference
        /// </summary>
        /// <returns>xml string</returns>
        public abstract string GenerateXml();

        /// <summary>
        /// To string
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return string.Format("{0} - {1}", Name, Path);
        }

        #region IEquatable<Reference> Members

        /// <summary>
        /// Determine if a reference is equal to another
        /// </summary>
        /// <param name="other">reference for comparison</param>
        /// <returns>true if the same</returns>
        /// <remarks>
        /// Base class implementation : can only check name
        /// </remarks>
        public virtual bool Equals(Reference other)
        {
            return other.Name == Name;
        }

        #endregion
    }
}
